<?php

require_once 'HTTP/Request.php';

class OAuth
{

    const REQUEST_SCHEME_HEADER = 'header';

    const REQUEST_SCHEME_POSTBODY = 'postbody';

    const REQUEST_SCHEME_QUERYSTRING = 'querystring';

    const GET = 'GET';

    const POST = 'POST';

    protected static $httpClient = null;

    public static function setHttpClient(HTTP_Request $httpClient)
    {
        self::$httpClient = $httpClient;
    }

    public static function getHttpClient()
    {
        if (!isset(self::$httpClient)):
            self::$httpClient = new HTTP_Request();
        else:
            self::$httpClient->removeHeader('Authorization');
            self::$httpClient->HTTP_Request();
        endif;
        return self::$httpClient;
    }

    public static function clearHttpClient()
    {
        self::$httpClient = null;
    }

    protected static $_validate = null;

    public static function checkUrl($url)
    {
        if (is_null(self::$_validate)) {
            self::$_validate = new Validate;
        }
        if (!self::$_validate->uri($url)) {
            return false;
        }
        return true;
    }

}